Information is transmitted between computer systems in the form of network packets passed from network device to network device, e.g., switches, in one or more interconnected networks. Each network device forwards received packets toward a destination specified by header information in the packets. The destination address may be for a device in a different network, which may be controlled by a third-party, and the packets may pass through any number of distinct networks in between the source and destination.
Some network devices, typically a switch, include memory allocated to a forwarding table. When the network device receives a packet, the network device can use the information in the forwarding table to determine how to handle the received packet. For example, the forwarding table may include a routing entry specifying an egress port connected to a next-hop along a path to a network destination.
In some network configurations, there may be multiple viable paths from a network device to a particular network destination. Equal-Cost Multi-Path (ECMP) routing allows for a forwarding table to include routing entries for each of the multiple paths. A switch supporting ECMP can then distribute network traffic across the multiple routes in an ECMP route set. Weighted-Cost Multi-Path (WCMP) routing enables some of the multiple viable paths in a multi-path route set to be used more than other paths in the same set. However, routing entries for a WCMP route set can consume a significant portion of the memory allocated to the forwarding table.